package baidu.reader.common.ui
{
    import baidu.ui.layout.*;
    
    import flash.display.*;

    public class BookPageBase extends AutoLayoutContainer
    {
        protected var _canGoNext:Boolean = true;
        protected var _canGoPrevious:Boolean = true;
        //protected var leftClickPane:ClickArea;
        //protected var rightClickPane:ClickArea;
		protected var leftClickPane:Sprite;
		protected var rightClickPane:Sprite;

        public function BookPageBase()
        {
            this.initModel();
            this.addPageBG();
            return;
        }

        protected function addPageBG() : void
        {
            return;
        }

        protected function initModel() : void
        {
            return;
        }

        public function goNextPage() : void
        {
            return;
        }

        public function goPreviousPage() : void
        {
            return;
        }

        public function goUp() : void
        {
            return;
        }

        public function goDown() : void
        {
            return;
        }

        protected function addClickArea() : void
        {
            if (this._canGoPrevious)
            {
                this.addLeftClickArea();
            }
            if (this._canGoNext)
            {
                this.addRightClickArea();
            }
            return;
        }

        protected function addRightClickArea() : void
        {
            return;
        }

        protected function addLeftClickArea() : void
        {
            return;
        }

        protected function removeRightClickArea() : void
        {
            if (this.rightClickPane)
            {
                this.rightClickPane.parent.removeChild(this.rightClickPane);
            }
            return;
        }

        protected function removeLeftClickArea() : void
        {
            if (this.leftClickPane)
            {
                this.leftClickPane.parent.removeChild(this.leftClickPane);
            }
            return;
        }

        public function set canGoPrevious(param1:Boolean) : void
        {
            if (param1 == this._canGoPrevious)
            {
                return;
            }
            if (param1)
            {
                this.addLeftClickArea();
            }
            else
            {
                this.removeLeftClickArea();
            }
            this._canGoPrevious = param1;
            return;
        }

        public function set canGoNext(param1:Boolean) : void
        {
            if (param1 == this._canGoNext)
            {
                return;
            }
            if (param1)
            {
                this.addRightClickArea();
            }
            else
            {
                this.removeRightClickArea();
            }
            this._canGoNext = param1;
            return;
        }

        public function get canGoPrevious() : Boolean
        {
            return this._canGoPrevious;
        }

        public function get canGoNext() : Boolean
        {
            return this._canGoNext;
        }

    }
}
